#ifndef _GAME_H_
#define _GAME_H_


#include "SDL2/SDL.h"
#include "SDL2/SDL_image.h"
#include "Scene.h"

class Game
{
public:
   static Game& getInstance()
    {
        static Game instance;
        return instance;
    }
    ~Game();
    void run();
    void init();
    void clean();
    void changeScene(Scene* scene);

    void handleEvents(SDL_Event* event);
    void update(float deltaTime);
    void render();

    SDL_Window* getWindow()  { return window; }
    SDL_Renderer* getRenderer()  { return renderer; }
    int getWindowWidth()  { return windowWidth; }
    int getWindowHeight() { return windowHeight; }
private:
    Game();
    //删除拷贝和赋值构造函数
    Game(const Game&) = delete;
    Game& operator=(const Game&) = delete;
    bool isRunning  = true;
    Scene* currentScene = nullptr; // 指向当前场景
    SDL_Window* window = nullptr; // 窗口
    SDL_Renderer* renderer = nullptr; // 渲染器
    int windowWidth = 600;  // 窗口宽度
    int windowHeight = 800; // 窗口高度
    int FPS = 60; // 帧率
    uint32_t frameTime; // 每帧时间
    float deltaTime; // 时间增量


};

#endif 
